import { createRouter, createWebHistory } from 'vue-router';





import Login from '../pages/Login.vue'; // 登陆界面


import Home from '../pages/Home.vue'; // 主界面
//院长视图
import RoleA from '../pages/home/RoleA.vue'
//环住视图
import RoleB from '../pages/home/RoleB.vue'
//角色视图
import RoleC from '../pages/home/RoleC.vue'


import AdvManage from '../pages/home/AdvManage.vue'//医嘱质控


import PatSearch from '../pages/home/PatSearch.vue'//患者检索
//在院患者
import NowHosp from '../pages/home/patsearch/NowHosp.vue'
//住院患者
import InHosp from '../pages/home/patsearch/InHosp.vue'
//门诊患者
import OutHosp from '../pages/home/patsearch/OutHosp.vue'


import UserBase from '../pages/home/UserBase.vue'//用户基本信息
import UserMessage from '../pages/home/UserMessage.vue'//消息中心


import Collection from '../pages/home/Collection.vue'//收藏
//患者收藏
import PatCollection from '../pages/home/collection/PatCollection.vue'
//医嘱收藏
import AdvCollection from '../pages/home/collection/AdvCollection.vue'


import Config from '../pages/home/Config.vue'//系统配置
//数据源配置
import SourceConfig from '../pages/home/config/SourceConfig.vue'
//角色配置
import RoleConfig from '../pages/home/config/RoleConfig.vue'
//闭环配置
import CloseConfig from '../pages/home/config/CloseConfig.vue'
import CloseConfigShow from '../pages/home/close/CloseConfigShow.vue'
//闭环配置列表
import CloseConfigA from '../pages/home/close/CloseConfigA.vue'
import CloseConfigB from '../pages/home/close/CloseConfigB.vue'
import CloseConfigC from '../pages/home/close/CloseConfigC.vue'
//日志查询
import Log from '../pages/home/config/Log.vue'
import CloseConfigC_a from '@/pages/home/close/CloseConfigC_a.vue';



const routes = [
  {
    path: '/',
    redirect: '/login', // 启动时默认跳转到登录页
  },
  {
      path: '/login',
      name: 'Login',
      component: Login,
  },
  {
    path: '/home',
    name: 'home',
    component: Home,// 主界面
    children : [
      {
        path: '/rolea',
        name: 'RoleA', //角色A
        component: RoleA,
        children: []
      },
      {
        path: '/roleb',
        name: 'RoleB',
        component: RoleB, //角色B
        children: []
      },
      {
        path: '/rolec',
        name: 'RoleC',
        component: RoleC, //角色C
        children: []
      },
      {
        path: '/advmanager', 
        name: 'AdvManage',
        component: AdvManage,//医嘱质控
        children: []
      },
      {
        path: '/patsearch',    
        name: 'patsearch',
        component: PatSearch,//患者检索
        children: [
          {
            path: '/nowhosp',
            name: 'NowHosp',  
            component: NowHosp,//在院患者
            children: []
          },
          {
            path: '/inhosp',
            name: 'InHosp', 
            component: InHosp,//历史住院患者
            children: []
          },
          {
            path: '/outhosp', 
            name: 'OutHosp',
            component: OutHosp,//历史门诊患者
            children: []
          }
        ]
      },
      {
        path: '/userbase',
        name: 'UserBase',
        component: UserBase,//用户基本信息
        children: []
      },
      {
        path: '/usermessage',
        name: 'UserMessage',
        component: UserMessage,//消息中心
        children: []
      },
      {
        path: '/collection',
        name: 'Collection',
        component: Collection,//收藏
        children: [{
          path: '/patcollection',
          name: 'PatCollection',
          component: PatCollection,//患者收藏
          children: []
        },
        {
          path: '/advcollection',
          name: 'AdvCollection',
          component: AdvCollection,//医嘱收藏
          children: []
        }]
      },
      {
        path: '/config',
        name: 'Config',
        component: Config,//系统配置
        children: [ {
          path: 'closeconfig',
          name: 'CloseConfig',
          component: CloseConfig,//闭环配置
          children: []
        },
        {
          path: '/roleconfig',
          name: 'RoleConfig',
          component: RoleConfig,//角色配置
          children: []
        },{
          path: '/sourceconfig',
          name: 'SourceConfig',
          component: SourceConfig,//数据源配置
          children: []
        },{
          path: '/log',
          name: 'Log',
          component: Log,//日志查询
          children: []
        }
      ]
      },
      {
        path: '/closeconfigshow',
        name: 'CloseConfigShow',
        component: CloseConfigShow,//闭环配置列表
        children: [
       {
          path: 'closeconfiga',
          name: 'CloseConfigA',
          component: CloseConfigA,//闭环配置基本信息
           //meta: { keepAlive: true, step: 1 },
          children: []
        },
        {
          path: 'closeconfigb',
          name: 'CloseConfigB',
          component: CloseConfigB,//闭环配置医嘱信息
          //meta: { keepAlive: true, step: 2 },
          children: []
        },
        {
          path: 'closeconfigc',
          name: 'CloseConfigC',
          component: CloseConfigC,//闭环配置节点信息
          //meta: { keepAlive: true, step: 3 },
          children: [
            {
              path: 'closeconfigc_a',
              name: 'closeConfigc_C',
              component: CloseConfigC_a,//闭环配置节点明细信息
            }
          ]
        }]
      },
    ]


    
  },
  
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL), // 自动匹配 publicPath
  routes,
});



export default router;